package net.kazed.nextaction.menu;

import net.kazed.nextaction.R;
import net.kazed.nextaction.database.Task;
import net.kazed.nextaction.timer.GenericTimerDialog;
import net.kazed.nextaction.timer.TaskTimerDialog;
import net.kazed.nextaction.timer.TimerDialog;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.net.Uri;
import android.view.Menu;

/**
 * Menu item for timer.
 * @author Koert Zeilstra
 */
public class TimerOptionMenuItem {
   
   private final int menuId;

   public TimerOptionMenuItem(Context context, Activity activity, int menuId) {
      this.menuId = menuId;
   }
   
   public TimerOptionMenuItem(Menu menu, int menuId) {
      this.menuId = menuId;
      menu.add(0, menuId, 0, R.string.menu_timer)
         .setIcon(R.drawable.menu_timer).setAlphabeticShortcut('t');
   }

   public void addToMenu(Menu menu) {
      menu.add(0, menuId, 0, R.string.menu_timer)
         .setIcon(R.drawable.menu_timer).setAlphabeticShortcut('t');
   }

   public boolean isMenu(int receivedItemId) {
      return menuId == receivedItemId;
   }

   public void onSelected() {
   }

   public Dialog createDialog(Activity activity, Task task) {
      TaskTimerDialog timerDialog = new TaskTimerDialog(activity);
      timerDialog.setTask(task);
      return timerDialog;
   }

   public Dialog createDialog(Activity activity, Uri notificationUri) {
      TimerDialog timerDialog = new GenericTimerDialog(activity, notificationUri);
      return timerDialog;
   }

}
